<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Happy dong
 * Created Time: 2019-07-30 19:56
 *
 * Version: 2.0
 */

namespace App\Modules\Employee\Transformers;


use League\Fractal\TransformerAbstract;

class AppointmentBgTransformer extends TransformerAbstract
{
	private $params;

	public function __construct($info = null)
	{
		$this->params = $info;
	}

	public function transform()
	{
		return empty($this->params) ? [] : [
			'portfolio_id'    => $this->params->id,
			'portfolio_name'  => $this->params->name,
			'portfolio_desc'  => $this->params->desc,
			'play_times'      => $this->params->play_times,
			'video_name'      => empty($this->params->resource) ? "" : empty($this->params->resource->video) ? "":$this->params->resource->video->name,
			'video_url'       => empty($this->params->resource) ? "" : empty($this->params->resource->video) ? "":$this->params->resource->video->url,
			'video_thumb'     => empty($this->params->resource) ? "" : empty($this->params->resource->video) ? "":$this->params->resource->video->thumb,
			'barber_id'       => empty($this->params->user) ? "" : $this->params->user->id,
			'barber_name'     => empty($this->params->user) ? "" : $this->params->user->nick,
			'barber_portrait' => isset($this->params->user) ? (isset($this->params->user->picture) ? $this->params->user->picture->image : '') : '',
			'service'         => $this->params->storeService,
		];
	}
}
